# -*- coding: utf-8 -*-
"""
Created on Sat Sep 14 16:45:16 2024

@author: Administrator
"""
import tkinter as tk

root = tk.Tk()
root.geometry('800x600')
root.title('Canvas Demo - Binding Event')

canvas = tk.Canvas(root, width=600, height=400, bg='white')
canvas.pack(anchor=tk.CENTER, expand=True)

python_image = tk.PhotoImage(file='E:\study\wpsyun\0.gif')
image_item = canvas.create_image(
    (100, 100),
    image=python_image
)
canvas.tag_bind(
    image_item,
    '<Button-1>',
    lambda e: canvas.delete(image_item)
)

root.mainloop()